import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/core/utils/user_manager.dart';
import 'package:enterprise_v6_app/router/app_pages.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';

class JobTicketWebPageController extends GetxController {
  late URLRequest url;

  late InAppWebViewController inAppWebViewController;

  @override
  void onInit() {
    super.onInit();
    final arguments = Get.arguments as Map<String, dynamic>;
    // 大票 作业计划id
    final String id = arguments['id'] as String;
    //final String businessType = arguments['businessType'] as String;
    // url = URLRequest(url: Uri.parse('http://192.168.50.131:30003/#/work-plan-flow?token=${UserManager.getToken()}&id=$id&isApp=1')); //$businessType
    // 外网
    url = URLRequest(url: Uri.parse('${Interface.workUrl}/#/work-plan-flow?token=${UserManager.getToken()}&id=$id&isApp=1')); //$businessType
  }

  /// webview加载完成后
  onWebViewCreated(InAppWebViewController controller) {
    inAppWebViewController = controller;
  }

  // 跳转作业票附件
  toJobTicket() {
    Get.toNamed(AppRoutes.jobTicketAttachment);
  }
}
